package router

import "smart_home/task/controller"

type Router struct {
	Tname string
	Spec  string
	Fn    func() error
}

var ls []Router

func init() {
	addRouter("use_mode_manual", "0/1 * * * * *", controller.GetUseModeManual)
	addRouter("use_mode_timing", "0 * * * * *", controller.GetUseModeTiming)
	addRouter("trip", "0 * * * * *", controller.GetTrip)
}

func addRouter(tname, spec string, fn func() error) {
	r := Router{Tname: tname, Spec: spec, Fn: fn}
	ls = append(ls, r)
}

func GetRouters() []Router {
	return ls
}
